package com.thoughtworks.bytecode2class;

import javaonhorse.test.fixture.basic.FixtureProvider;

import java.io.IOException;

public abstract class ClassReaderFixtures implements FixtureProvider {

    public ClassReader get(String className) {
        try {
                ClassReader classReader = new ClassReader();
                classReader.read(getClass().getResourceAsStream(className));
                return classReader;
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
    }

    public static class HelloWorld extends ClassReaderFixtures {
        public Object get() {
            return get("/HelloWorld.class");
        }
    }

    public static class FieldsAndInterfaces extends ClassReaderFixtures {
        public Object get() {
            return get("/FieldsAndInterfaces.class");
        }
    }

    public static class Interface extends ClassReaderFixtures {
        public Object get() {
            return get("/Interface.class");
        }
    }

    public static class Fibonacci extends ClassReaderFixtures {
        public Object get() {
            return get("/Fibonacci.class");
        }
    }

    public static class InterfaceImpl extends ClassReaderFixtures {
        public Object get() {
            return get("/InterfaceImpl.class");            
        }
    }

    public static class MyAnnotation extends ClassReaderFixtures {

        public Object get() {
            return get("/MyAnnotation.class");
        }
    }

    public static class MyAbstractClass extends ClassReaderFixtures {

        public Object get() {
            return get("/MyAbstractClass.class");
        }
    }

    public static class SwitchStatement extends ClassReaderFixtures {

        public Object get() {
            return get("/SwitchStatement.class");
        }
    }

    public static class IfElseStatement extends ClassReaderFixtures {

        public Object get() {
            return get("/IfElseStatement.class");
        }
    }

    public static class InvokeInterfaceMethod extends ClassReaderFixtures {

        public Object get() {
            return get("/InvokeInterfaceMethod.class");
        }
    }

}
